package com.tlm.rabbitmqprovider;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RabbitMqController {
    @Autowired
    private AmqpTemplate amqpTemplate;
    //监听一个消息(queuesToDeclare：创建消息队列@Queue声明消息队列名称)
    @RabbitListener(queuesToDeclare = @Queue("tianlimin"))
    public void provider(String message){
        System.out.println("我是消息队列接收到的数据"+message);
    }
}
